<?php
 if(!isset($sp))	
  	$sp=explode("/",$_SERVER['PHP_SELF']);

  if($_SERVER['HTTP_HOST'] == "localhost" || $_SERVER['HTTP_HOST'] == "192.168.1.25")
   {
	  $sp[1] = '/' . $sp[1];
   }
  else
	  $sp[1] = '';
  
  $w_root = $_SERVER['SERVER_NAME'] . $sp[1];
  $w_root = str_replace('//','/',$w_root);
  $w_root = str_replace('\\\\','\\',$w_root);
  
  $s_root = $_SERVER['DOCUMENT_ROOT'] . $sp[1];
  $s_root = str_replace('//','/',$s_root);
  $s_root = str_replace('\\\\','\\',$s_root); 
/*========End Setting up web root and server root =============*/
  require_once $s_root.'/libraryfiles/config.php'; 
?>
<?php
		
if(isset($_SESSION['username']))
{
	 $email_urlshort=$_SESSION['username'];

	 $userex_short="SELECT *FROM tbluser WHERE email='".$email_urlshort."'";
	 $run_url=mysql_query($userex_short);
	 $ulr_username=mysql_fetch_assoc($run_url);
	 $url_shortname= $ulr_username['username'];
	 $_SESSION['test1']=$url_shortname;
	if(isset($_POST['s_id']))
	{
	$select_compare ="SELECT by_company,style_path FROM tbl_style";
	$run_select=mysql_query($select_compare);
	$row_select=mysql_fetch_array($run_select);
	$_SESSION['test2']=$row_select['by_company'];
	$_SESSION['test3']=$row_select['style_path'];
	$s_id	= $_POST['s_id'];
	if($url_shortname==$row_select['by_company']){
		$update_style=mysql_query("UPDATE tbl_style SET style_path='".$s_id."' ");
	}else{
	$s_insert = mysql_query("INSERT INTO tbl_style (style_path, by_company) VALUE ('".$s_id."','".$url_shortname."')");
	}
	}
}
//header from include
?>
<?php include(S_ROOT.'/company/header_top.php');?>
<body>
<?php
    include(S_ROOT.'/includefiles/navmenu.php');
?>
  <!-- End Header and Nav -->
<div class="clear"></div>
<?php include(S_ROOT.'/company/header_admin.php');?>
<!------------the end header from include----------------->


<div class="row"> 
<!--Error-->
<?php
$CURRENT_URL = W_ROOT;
if(isset($_GET['error'])!=""){
    $sms = $_GET['error'];
    if($sms==1){
    	$message = 'Email Address &amp; Password is Invalid';	
    }else if($sms==2){
    	$message = 'Your Account is not active yet!';		
    }
    else
    {
        $message = $_GET['error'];
    }      
} else {
	$message = '';
}

	// if we got an error then we display it here
	if( $message ){
		?>
        <div class="alert alert-block alert-error fade in" style="margin-top: 10px;">
            <button data-dismiss="alert" class="close" type="button">x</button>
            <h3 class="alert-heading"><!--Oh snap! You got an error!--><?php echo $lang['SNAB_ERROO'];?></h3>
            <p style="font-size:16px;"><blink><?php echo $message?></blink></p>
          </div>
        <?php
	}
?> 
<!--end Error-->

    <div class="nine columns">
   	<?php
        if(!isset($content))
        $content=basename($_SERVER['PHP_SELF']);
        require ($content);
        ?>
    </div>
    <div class="three columns">
    	<?php 
            //include(S_ROOT.'/company/dashboard/statistic/showclick.php');
    		include(S_ROOT.'/company/left.php');
    	?>
    </div>   
</div>
<!--end <div class="row">-->
<?php include(S_ROOT.'/includefiles/bottom.php');?>
</body>
</html>
<?php exit;?>